/*SegmenteTree
 *relic@20070521
 */
#include <cstdio>
#include <cstring>

struct STnode {
	int lf, rt;
	int x, y;
	int cover;
};
struct SegTree {
	int tot;
	STnode *st;
	SegTree(int a, int b);
	~SegTree();
	void STmake(int a, int b);
	void STinsert(int c, int d, int n = 1);
	void STdelete(int c, int d, int n = 1);
	int STcount(int c, int d, int n = 1, int cnt = 0);
};
inline int cover(int a, int b, int c, int d) {
	if (a < c) {
		if (b > c) {
			return b > d ? d - c : b - c;
		} else {
			return 0;
		}
	} else if (c <= a && a <= d) {
		return b < d ? b - a : d - a;
	} else {
		return 0;
	}
}
SegTree::SegTree(int a, int b) {
	st = new STnode [(b - a) * 2];
	memset(st, 0, sizeof (STnode) * (b - a) * 2);
	tot = 0;
	STmake(a, b);
}
SegTree::~SegTree() {
	delete [] st;
	tot = 0;
}
void SegTree::STmake(int a, int b) {
	tot ++;
	int now = tot;
	st[now].x = a; st[now].y = b;
	if (a + 1 < b) {
		st[now].lf = tot + 1;
		STmake(a, (a + b) / 2);
		st[now].rt = tot + 1;
		STmake((a + b) / 2, b);
	}
}
void SegTree::STinsert(int c, int d, int n) {
	if (c <= st[n].x && st[n].y <= d) {
		st[n].cover ++;
	} else {
		if (c < (st[n].x + st[n].y) / 2)
			STinsert(c, d, st[n].lf);
		if (d > (st[n].x + st[n].y) / 2)
			STinsert(c, d, st[n].rt);
	}
}
void SegTree::STdelete(int c, int d, int n) {
	if (c <= st[n].x && st[n].y <= d) {
		st[n].cover --;
	} else {
		if (c < (st[n].x + st[n].y) / 2)
			STinsert(c, d, st[n].lf);
		if (d > (st[n].x + st[n].y) / 2)
			STinsert(c, d, st[n].rt);
	}
}
int SegTree::STcount(int c, int d, int n, int cnt) {
	if (0 == n) return 0;
	if (st[n].cover > 0) {
		return cnt += cover(c, d, st[n].x, st[n].y);
	} else {
		if (c < (st[n].x + st[n].y) / 2)
			cnt += STcount(c, d, st[n].lf);
		if (d > (st[n].x + st[n].y) / 2)
			cnt += STcount(c, d, st[n].rt);
	}
	return cnt;
}
int main() {
	int a, b;
	while (scanf("%d%d", &a, &b) != EOF) {
		SegTree t(a, b);
		int n, z, x;
		scanf("%d", &n);
		for (int i = 0; i < n; ++ i) {
			scanf("%d%d", &z, &x);
			t.STinsert(z, x);
		}
		for (int i = 0; i < (b - a) * 2; ++ i) {
			printf ("index:%d %d %d, %d %d --%d\n", i, t.st[i].x, t.st[i].y, t.st[i].lf, t.st[i].rt, t.st[i].cover);
		}
		int st, ed;
		while (scanf("%d%d", &st, &ed) != EOF) {
			printf("count: %d\n", t.STcount(st, ed));
		}
	}
	return 0;
}
